feat: Smart route merging to prevent web.php overwrite during Breeze installation#477
Closed
AlbinXXX wants to merge 1 commit intolaravel:2.xfrom
Closed
feat: Smart route merging to prevent web.php overwrite during Breeze installation#477AlbinXXX wants to merge 1 commit intolaravel:2.xfrom
AlbinXXX wants to merge 1 commit intolaravel:2.xfrom
Conversation
- Add --force flag to allow explicit overwrite when desired - Detect default Laravel web.php scaffold vs custom routes - Merge Breeze routes into existing web.php when custom routes detected - Create timestamped backup before merging - Ensure idempotency (running twice won't duplicate routes) - Add required use statements without duplicates - Apply to all stacks: Blade, API, Inertia (Vue/React), Livewire Fixes issue where breeze:install would overwrite existing custom routes in routes/web.php, causing loss of developer work.
Author
|
Why? This is a bug me any my professor at uni where discussing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When installing Laravel Breeze on a project, the
breeze:installcommand completely overwrites theroutes/web.phpfile, destroying any custom routes the developer may have already defined. This causes:Solution
Implemented Smart Route Merging that intelligently detects whether the existing
web.phpcontains default Laravel scaffold content or custom routes, and acts accordingly:web.php)web.php--forceflag usedChanges Made
Files Modified
src/Console/InstallCommand.php- Added smart merging helper methodssrc/Console/InstallsBladeStack.php- Updated to use smart mergingsrc/Console/InstallsApiStack.php- Updated to use smart mergingsrc/Console/InstallsInertiaStacks.php- Updated to use smart merging (Vue & React)src/Console/InstallsLivewireStack.php- Updated to use smart mergingNew Features
--forceflag - Allows explicit complete overwrite when desiredweb.phpis the default Laravel templateweb.php.backup.YYYY-MM-DD-HHMMSS) before merging